import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart';
import 'package:flutter_app/widgets/commom_image.dart';

var textStyles = const TextStyle(color: Colors.black12);

class InfoItem extends StatefulWidget {
  final Map data;
  const InfoItem({Key? key, required this.data}) : super(key: key);

  @override
  State<InfoItem> createState() => _InfoItemState();
}

class _InfoItemState extends State<InfoItem> {
  @override
  Widget build(BuildContext context) {
    return Container(
      padding: const EdgeInsets.fromLTRB(10, 10, 10, 10),
      height: 100,
      child: Row(
        children: [
          CommonImage(
            src: widget.data["imgSrc"],
            width: 200,
            height: 100,
          ),
          const Padding(padding: EdgeInsets.only(right: 10)),
          Expanded(
              child: Column(
            crossAxisAlignment: CrossAxisAlignment.start,
            mainAxisAlignment: MainAxisAlignment.spaceBetween,
            children: [
              Text(
                widget.data["title"] ?? '',
                maxLines: 2,
                style: const TextStyle(
                    fontWeight: FontWeight.w600,
                    overflow: TextOverflow.ellipsis),
              ),
              Row(
                mainAxisAlignment: MainAxisAlignment.spaceBetween,
                children: [
                  Text(
                    widget.data["from"] ?? '',
                    style: textStyles,
                  ),
                  Text(
                    widget.data["date"] ?? '',
                    style: textStyles,
                  )
                ],
              )
            ],
          ))
        ],
      ),
    );
  }
}
